/**
 * 
 */
package com.java.test.messagecenter.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author app更新管理
 *
 */
public class AppUpdateInfo implements RowMapper<AppUpdateInfo> {

	private int id;

	
	// 渠道ID
	private String channelId;
	
	private String channelidStr;
	
	// 终端名称
	private String terminalName;

	// 更新方式
	private String updateMode;

	// 版本编号
	private String versionNumber;

	// 更新地址
	private String updateAddress;

	// 备注
	private String content;

	// 创建时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime createTime;

	// 添加人
	private String addPeople;
	
	

	public String getChannelidStr() {
		return channelidStr;
	}

	public void setChannelidStr(String channelidStr) {
		this.channelidStr = channelidStr;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTerminalName() {
		return terminalName;
	}

	public void setTerminalName(String terminalName) {
		this.terminalName = terminalName;
	}

	public String getUpdateMode() {
		return updateMode;
	}

	public void setUpdateMode(String updateMode) {
		this.updateMode = updateMode;
	}

	public String getVersionNumber() {
		return versionNumber;
	}

	public void setVersionNumber(String versionNumber) {
		this.versionNumber = versionNumber;
	}

	public String getUpdateAddress() {
		return updateAddress;
	}

	public void setUpdateAddress(String updateAddress) {
		this.updateAddress = updateAddress;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public LocalDateTime getCreateTime() {
		return createTime;
	}

	public void setCreateTime(LocalDateTime createTime) {
		this.createTime = createTime;
	}

	public String getAddPeople() {
		return addPeople;
	}

	public void setAddPeople(String addPeople) {
		this.addPeople = addPeople;
	}

	
	
	
	public String getChannelId() {
		return channelId;
	}

	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}

	/**
	 *
	 */
	@Override
	public AppUpdateInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
		AppUpdateInfo info = new AppUpdateInfo();

		info.setId(rs.getInt("id"));
		info.setContent(rs.getString("content"));
		info.setCreateTime(rs.getTimestamp("create_time") == null ? null
				: rs.getTimestamp("create_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());

		info.setUpdateAddress(rs.getString("update_address"));
		info.setUpdateMode(rs.getString("update_mode"));
		info.setVersionNumber(rs.getString("version_number"));
		
		info.setAddPeople(rs.getString("add_people"));
		

		info.setChannelId(rs.getString("channel_id"));
		
		info.setTerminalName(rs.getString("terminal_name"));
		
		return info;
	}

}
